import request from './request'

/**
 * 测试报告API
 */

// 获取报告列表
export function getReports(params) {
  return request({
    url: '/reports/',
    method: 'get',
    params
  })
}

// 获取报告详情
export function getReport(id) {
  return request({
    url: `/reports/${id}`,
    method: 'get'
  })
}

// 生成报告
export function generateReport(data) {
  return request({
    url: '/reports/generate',
    method: 'post',
    data
  })
}

// 删除报告
export function deleteReport(id) {
  return request({
    url: `/reports/${id}`,
    method: 'delete'
  })
}

// 导出报告
export function exportReport(id, format) {
  return request({
    url: `/reports/${id}/export`,
    method: 'get',
    params: { format },
    responseType: 'blob'
  })
}

// 获取报告统计数据
export function getReportStats(id) {
  return request({
    url: `/reports/${id}/stats`,
    method: 'get'
  })
}

// 分享报告
export function shareReport(id) {
  return request({
    url: `/reports/${id}/share`,
    method: 'post'
  })
}
